<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
	<link rel="stylesheet" type="text/css" href="../../css/api.css" />
	<link rel="stylesheet" type="text/css" href="../../css/common.css" />
	<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
  <title>学术</title>
  <style>
		html, body {width: 100%;min-height: 100%;background: #f0f0f0;}
    .h20 {height: 0.5rem;background: #f0f0f0;}

    .sqsb_con {}
    .ml_btns {
      position: fixed;
      bottom: 0;
      width: 100%;
    }
    .ml_btn {
      float: left;
      width: 100%;
      padding: 0.5rem 0;
      text-align: center;
      background: #2997e4;
      color: #fff;
    }
    .sqsb_con ul {
      background: #fff;
    }
    .sqsb_con ul li {
      font-size: 0.75rem;
      color: #999;
      padding: 0.75rem 1rem;
      line-height: 1.2rem;
    }
    .li_flex_txt {
      color: #999;
    }
    .sqsb_con ul li i {
      font-style: normal;
      color: #f00;
    }
    .sqsb_con ul li span {
      float: right;
      color: #333;
    }
    .sqsb_con ul li input[type="text"],
    .sqsb_con ul li input[type="date"] {
      border: none;
      float: right;
      color: #333;
      font-size: 0.75rem;
      position: relative;
      text-align: right;
      width: 50%;
      height: 1.2rem;
    }
    .aui-radio {
      width: 0.8rem;
      height: 0.8rem;
      vertical-align: middle;
    }
    .aui-radio:before,
    .aui-radio:after {
      display: none;
    }
    .sqsb_con ul li span.aui-list-item-arrow {
      position: relative;
      padding-right: 0.5rem;
    margin-top: 0.55rem;
    }
    .sqsb_con ul li span.aui-list-item-arrow:before {
      right: 0;
    }
    .sqsb_con ul li {
      border-bottom: 1px solid #f0f0f0;
    }
    .sqsb_con ul li > label {
      width: 100%;
      color: inherit;
    }
    .sqsb_con ul {
      margin-bottom: 3rem;
    }
    .sqsb_con #national {
      display: inline-block;
      width: 5rem;
    }
    .sqsb_con #param_province {
      display: inline-block;
      width: 40%;
      margin-right: 5%;
    }
    .sqsb_con #param_city {
      display: inline-block;
      width: 55%;
    }
    .sqsb_con .sel_box {
      display: inline-block;
      width: calc(100% - 3rem);
      font-size: 0;
    }
    .sqsb_con ul li select {
      height: auto;
      direction: rtl;
    }
    .sqsb_con ul li select option {
      direction: ltr;
    }
    .sqsb_con .li_flex {
        display: -webkit-box;
        display: -webkit-flex;
        display: flex;
        -webkit-box-orient: vertical;
        box-orient: vertical;
        -webkit-flex-direction: row;
        flex-direction: row;
        -webkit-box-pack: justify;
        -webkit-justify-content: space-between;
        justify-content: space-between;
        -webkit-box-align: start;
        -webkit-align-items: flex-start;
        align-items: flex-start;
    }
    .li_flex {
      display: inline-block;
    }
	</style>
</head>
<body>
<div id="app" v-cloak>
  <div class="sqsb_con">
    <ul>
      <li>
        <label for="name">
        姓名<i>*</i> <input type="text" v-model="name" id="name">
        </label>
      </li>
      <li>
        性别<i>*</i> <span>
          <label><input class="aui-radio" type="radio" value="1" v-model="sex"> 男</label>
          <label><input class="aui-radio" type="radio" value="2" v-model="sex"> 女</label>
        </span>
      </li>
      <li>
        <label for="birthday">
        <!-- 出生年月<i>*</i> <span class="aui-list-item-arrow" v-model="birthday" placeholder="1990-01-01"></span> -->
        出生年月<i>*</i> <span class="aui-list-item-arrow"></span><input type="date" v-model="birthday" id="birthday">
        </label>
      </li>
      <li class="li_flex">
        <div class="li_flex_txt">民族<i>*</i></div> <!-- <input type="text" v-model="ethnic"> -->
        <select id="national" v-model="nationals">
          <option v-for="item in arrNational" :value="item">{{item}}</option>
        </select>
      </li>
      <li class="li_flex">
        <div class="li_flex_txt">籍贯<i>*</i></div> <!-- <input type="text" v-model="native_place"> -->
        <div class="sel_box">
          <select name="province" id="param_province" v-model="provinces">
            <option v-for="item in arrProvinces" :value="item">{{item}}</option>
          </select>
          <select name="city" id="param_city" v-model="city">
            <option v-for="item in arrCitystemp" :value="item">{{item}}</option>
          </select>
        </div>

      </li>
      <li>
        <label for="party">
        党派<i>*</i> <input type="text" v-model="party" id="party">
        </label>
      </li>
      <li>
        <label for="work_unit">
        工作单位<i>*</i> <input type="text" v-model="work_unit" id="work_unit">
        </label>
      </li>
      <li>
        <label for="tel">
        手机号<i>*</i> <input type="text" v-model="tel" id="tel">
        </label>
      </li>
      <li>
        <label for="hometel">
        座机号 <input type="text" v-model="hometel" id="hometel">
        </label>
      </li>
      <li>
        <label for="address">
        家庭地址 <input type="text" v-model="address" id="address">
        </label>
      </li>
      <li>
          <label for="email">
            邮箱 <input type="text" v-model="email" id="email">
          </label>
      </li>
      <li>
          <label for="postcode">
            邮编 <input type="text" v-model="postcode" id="postcode">
          </label>
      </li>
      <li>
          <label for="degree">
            学历 <input type="text" v-model="degree" id="degree">
          </label>
      </li>
      <li>
          <label for="job_name">
            职称 <input type="text" v-model="job_name" id="job_name">
          </label>
      </li>
      <li>
          <label for="specialty">
            学科专长 <input type="text" v-model="specialty" id="specialty">
          </label>
      </li>
    </ul>
  </div>
  <div class="ml_btns" @click="sqrh()">
    <div class="ml_btn">
      提交
    </div>
  </div>
</div>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/utils.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript">
function reData () {
  app.$data.xhjjIsApply = 0
  app.$data.xhjjStatus = 1
  app.$data.xhjjText = '审核中'
}
function goback () {
  var jsfun = 'window.location.reload()';

  api.execScript({
    name: 'index_detail_xh',
    frameName: 'index_detail_xh',
    script: jsfun
});
  api.closeWin({
    name:api.pageParam.name
  });
}
// 完成首页初始化
apiready = function(){
  var app = new Vue({
		el: '#app',
		data: {
      group_id: '', //学会id
      name: '', //姓名
      sex: '1', //性别（1:男；2:女）
      birthday: '', //生日
      ethnic: '', //名族
      native_place: '', //籍贯
      party: '', //党派
      work_unit: '', //工作单位
      tel: '', //联系电话
      address: '', //家庭地址
      email: '', //邮箱
      postcode: '', //邮编
      degree: '', //学历
      job_name: '', //职称
      specialty: '', //学科专长
      hometel: '', // 座机号
      arrNational: [],
      nationals: '请选择民族',
      arrProvinces: [],
      provinces: '请选择省份',
      arrCity: [],
      city:'请选择城市',
      arrCitystemp:[]
		},
		created: function() {
      var $_this = this
      $_this.group_id = api.pageParam.id
      $_this.token = $api.getStorage('token')
      if(!$api.getStorage('token')){
        api.confirm( {
            title: '是否登录',
            msg: '确认是否登录？',
            buttons: [ '确定', '取消' ]
          }, function ( ret, err ) {
            var index = ret.buttonIndex;
            if ( index == 1 ) {
              api.openWin({
                name: 'login',
                url: '../five_frame/login_header.html',
                delay: 200,
                bounces: false
              });
              return;
            } else {
              api.closeWin({
                  name: name
              });
              return
            }
          })
          return
        }
      $_this.arrNational = [
            '请选择民族',"汉族", "壮族", "满族", "回族", "苗族", "维吾尔族", "土家族", "彝族", "蒙古族", "藏族", "布依族", "侗族", "瑶族", "朝鲜族", "白族", "哈尼族",
            "哈萨克族", "黎族", "傣族", "畲族", "傈僳族", "仡佬族", "东乡族", "高山族", "拉祜族", "水族", "佤族", "纳西族", "羌族", "土族", "仫佬族", "锡伯族",
            "柯尔克孜族", "达斡尔族", "景颇族", "毛南族", "撒拉族", "布朗族", "塔吉克族", "阿昌族", "普米族", "鄂温克族", "怒族", "京族", "基诺族", "德昂族", "保安族",
            "俄罗斯族", "裕固族", "乌孜别克族", "门巴族", "鄂伦春族", "独龙族", "塔塔尔族", "赫哲族", "珞巴族"
      ];
      $_this.arrProvinces = ['请选择省份','北京市','上海市','天津市','重庆市','河北省','山西省','内蒙古省','辽宁省','吉林省','黑龙江省','江苏省','浙江省','安徽省','福建省','江西省','山东省','河南省','湖北省','湖南省','广东省','广西省','海南省','四川省','贵州省','云南省','西藏省','陕西省','甘肃省','宁夏省','青海省','新疆省','香港','澳门','台湾'];
      $_this.arrCity = [['请选择城市'],
	["东城区", "西城区", "崇文区", "宣武区", "朝阳区", "丰台区", "石景山区", "海淀区", "门头沟区", "房山区", "通州区", "顺义区", "昌平区", "大兴区", "怀柔区", "平谷区", "密云县", "延庆县"],
	["黄浦区", "卢湾区", "徐汇区", "长宁区", "静安区", "普陀区", "虹口区", "杨浦区", "闵行区", "宝山区", "嘉定区", "浦东新区", "金山区", "松江区", "青浦区", "南汇区", "奉贤区", "崇明县"],
	["和平区", "河东区", "河西区", "南开区", "河北区", "红桥区", "塘沽区", "汉沽区", "大港区", "东丽区", "西青区", "津南区", "北辰区", "武清区", "宝坻区", "宁河县", "静海县", "蓟县"],
	["万州区", "涪陵区", "渝中区", "大渡口区", "江北区", "沙坪坝区", "九龙坡区", "南岸区", "北碚区", "万盛区", "双桥区", "渝北区", "巴南区", "黔江区", "长寿区", "綦江县", "潼南县", "铜梁县", "大足县", "荣昌县", "璧山县", "梁平县", "城口县", "丰都县", "垫江县", "武隆县", "忠县", "开县", "云阳县", "奉节县", "巫山县", "巫溪县", "石柱土家族自治县", "秀山土家族苗族自治县", "酉阳土家族苗族自治县", "彭水苗族土家族自治县", "江津市", "合川市", "永川市", "南川市"],
	["石家庄市","张家口市","承德市","秦皇岛市","唐山市","廊坊市","保定市","衡水市","沧州市","邢台市","邯郸市"],
	["太原市","朔州市","大同市","阳泉市","长治市","晋城市","忻州市","晋中市","临汾市","吕梁市","运城市"],
	["呼和浩特市","包头市","乌海市","赤峰市","通辽市","呼伦贝尔市","鄂尔多斯市","乌兰察布市","巴彦淖尔市","兴安盟","锡林郭勒盟","阿拉善盟"],
	["沈阳市","朝阳市","阜新市","铁岭市","抚顺市","本溪市","辽阳市","鞍山市","丹东市","大连市","营口市","盘锦市","锦州市","葫芦岛市"],
	["长春市","白城市","松原市","吉林市","四平市","辽源市","通化市","白山市","延边州"],
	["哈尔滨市","齐齐哈尔市","七台河市","黑河市","大庆市","鹤岗市","伊春市","佳木斯市","双鸭山市","鸡西市","牡丹江市","绥化市","大兴安岭地区"],
	["南京市","徐州市","连云港市","宿迁市","淮安市","盐城市","扬州市","泰州市","南通市","镇江市","常州市","无锡市","苏州市"],
	["杭州市","湖州市","嘉兴市","舟山市","宁波市","绍兴市","衢州市","金华市","台州市","温州市","丽水市"],
	["合肥市","宿州市","淮北市","亳州市","阜阳市","蚌埠市","淮南市","滁州市","马鞍山市","芜湖市","铜陵市","安庆市","黄山市","六安市","巢湖市","池州市","宣城市"],
	["福州市","南平市","莆田市","三明市","泉州市","厦门市","漳州市","龙岩市","宁德市"],
	["南昌市","九江市","景德镇市","鹰潭市","新余市","萍乡市","赣州市","上饶市","抚州市","宜春市","吉安市"],
	["济南市","青岛市","聊城市","德州市","东营市","淄博市","潍坊市","烟台市","威海市","日照市","临沂市","枣庄市","济宁市","泰安市","莱芜市","滨州市","菏泽市"],
	["郑州市","开封市","三门峡市","洛阳市","焦作市","新乡市","鹤壁市","安阳市","濮阳市","商丘市","许昌市","漯河市","平顶山市","南阳市","信阳市","周口市","驻马店市","济源市"],
	["武汉市","十堰市","襄樊市","荆门市","孝感市","黄冈市","鄂州市","黄石市","咸宁市","荆州市","宜昌市","随州市","省直辖县级行政单位","恩施州"],
	["长沙市","张家界市","常德市","益阳市","岳阳市","株洲市","湘潭市","衡阳市","郴州市","永州市","邵阳市","怀化市","娄底市","湘西州"],
	["广州市","深圳市","清远市","韶关市","河源市","梅州市","潮州市","汕头市","揭阳市","汕尾市","惠州市","东莞市","珠海市","中山市","江门市","佛山市","肇庆市","云浮市","阳江市","茂名市","湛江市"],
	["南宁市","桂林市","柳州市","梧州市","贵港市","玉林市","钦州市","北海市","防城港市","崇左市","百色市","河池市","来宾市","贺州市"],
	["海口市","三亚市","省直辖县级行政单位"],
	["成都市","广元市","绵阳市","德阳市","南充市","广安市","遂宁市","内江市","乐山市","自贡市","泸州市","宜宾市","攀枝花市","巴中市","达州市","资阳市","眉山市","雅安市","阿坝州","甘孜州","凉山州"],
	["贵阳市","六盘水市","遵义市","安顺市","毕节地区","铜仁地区","黔东南州","黔南州","黔西南州"],
	["昆明市","曲靖市","玉溪市","保山市","昭通市","丽江市","思茅市","临沧市","德宏州","怒江州","迪庆州","大理州","楚雄州","红河州","文山州","西双版纳州"],
	["拉萨市","那曲地区","昌都地区","林芝地区","山南地区","日喀则地区","阿里地区"],
	["西安市","延安市","铜川市","渭南市","咸阳市","宝鸡市","汉中市","榆林市","安康市","商洛市"],
	["兰州市","嘉峪关市","白银市","天水市","武威市","酒泉市","张掖市","庆阳市","平凉市","定西市","陇南市","临夏州","甘南州"],
	["西宁市","海东地区","海北州","海南州","黄南州","果洛州","玉树州","海西州"],
	["银川市","石嘴山市","吴忠市","固原市","中卫市"],
	["乌鲁木齐市","克拉玛依市","自治区直辖县级行政单位","喀什地区","阿克苏地区","和田地区","吐鲁番地区","哈密地区","克孜勒苏柯州","博尔塔拉州","昌吉州","巴音郭楞州","伊犁州","塔城地区","阿勒泰地区"],
	["香港"],
	["澳门"],
	["台北市","高雄市","台中市","花莲市","基隆市","嘉义市","金门市","连江市","苗栗市","南投市","澎湖市","屏东市","台东市","台南市","桃园市","新竹市","宜兰市","云林市","彰化市"]];

      $_this.arrCitystemp = $_this.arrCity[0]
		},
		methods: {
      sqrh: function () {
        var $_this = this;
        if ($_this.name == '') {
                api.toast({ msg: '请输入姓名',duration: 2000,location:'middle' });
          return
        } else if ($_this.birthday == '') {
                api.toast({ msg: '请输入出生年月',duration: 2000,location:'middle' });
          return
        } else if ($_this.nationals == '请选择民族') {
                api.toast({ msg: '请选择民族',duration: 2000,location:'middle' });
          return
        } else if ($_this.provinces == '请选择省份' || $_this.city == '请选择城市') {
                api.toast({ msg: '请输入籍贯',duration: 2000,location:'middle' });
          return
        } else if ($_this.party == '') {
                api.toast({ msg: '请输入党派',duration: 2000,location:'middle' });
          return
        } else if ($_this.work_unit == '') {
                api.toast({ msg: '请输入工作单位',duration: 2000,location:'middle' });
          return
        } else if ($_this.tel == '' || !/^[1][3,4,5,7,8][0-9]{9}$/.test($_this.tel)) {
                api.toast({ msg: '请输入正确的手机号',duration: 2000,location:'middle' });
          return
        } else if ($_this.email != '' && !/^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test($_this.email)) {
                api.toast({ msg: '请输入正确的邮箱',duration: 2000,location:'middle' });
          return
        }
  			api.ajax({
  				url: window.Url.applyGroup,
          method: 'post',
          headers: {
			        'Content-Type': 'application/json',
              'baseParams': $_this.token //token
          },
          data: {
            body: {
              group_id: $_this.group_id, //学会id
              name: $_this.name, //姓名
              sex: $_this.sex, //性别（1:男；2:女）
              birthday: $_this.birthday, //生日
              ethnic: $_this.nationals, //名族
              native_place: $_this.provinces + $_this.city, //籍贯
              party: $_this.party, //党派
              work_unit: $_this.work_unit, //工作单位
              tel: $_this.tel, //联系电话
              hometel: $_this.hometel, //座机号
              address: $_this.address, //家庭地址
              email: $_this.email, //邮箱
              postcode: $_this.postcode, //邮编
              degree: $_this.degree, //学历
              job_name: $_this.job_name, //职称
              specialty: $_this.specialty, //学科专长
            }
          },
  				timeout: 300,
  			}, function(ret, err) {
  					if (ret) {
              // api.alert({ msg: JSON.stringify(ret) });
              if (ret.code == 2) {
                alert('用户未登录，请返回登录')
                $api.rmStorage('token')
                $api.rmStorage('data')
                goback()
                 return
              } else if (ret.code == 0) {
                  alert('提交成功')
                  goback()
                } else {
                    api.alert({ msg: JSON.stringify(ret.message) });
                }
  					} else {
  							api.alert({ msg: JSON.stringify(err) });
  					}
  			})
      }
		},
    watch:{
      provinces:function() {
          var $_this = this;
          // alert($_this.provinces)
          for(var i=0;i<$_this.arrProvinces.length;i++){
            if($_this.arrProvinces[i] == $_this.provinces){
              $_this.arrCitystemp = $_this.arrCity[i]
              $_this.city = $_this.arrCitystemp[0]
              return;
            }
          }

      }
    }
	})
}
</script>
</body>
</html>
